package com.wiscamp.ninechapters.problems.domain.repositories;


import com.wiscamp.ninechapters.problems.domain.models.sets.ProblemSet;
import com.wiscamp.ninechapters.problems.domain.models.sets.SetProblem;
import cube.ddd.common.query.PagedObjects;
import cube.ddd.common.query.PagedQuery;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;

import java.time.LocalDateTime;
import java.util.Collection;

public interface ProblemSetRepository {
    // region problem set
    ProblemSet getProblemSet(@Min(0) long setId);

    ProblemSet getProblemSetByCode(@NotBlank String setCode, @Min(0) long organizationId);

    Collection<ProblemSet> getProblemSetsByName(@NotBlank String setName, @Min(0) long organizationId);

    Collection<ProblemSet> getProblemSetsByOrganization(@Min(0) long organizationId);

    Collection<ProblemSet> getProblemSetsByRule(@Min(0) long ruleId);

    PagedObjects<ProblemSet> getProblemSetsByQuery(@NotNull PagedQuery query);

    Collection<Long> getProblemSetIdsByCreatorAndDate(@Min(0) long creatorId, LocalDateTime startDate, LocalDateTime endDate);

    Collection<Long> getProblemIdsBySet(@Min(0) long setId);

    Collection<Long> getProblemIdsBySets(@NotEmpty Collection<Long> setIds);

    ProblemSet saveProblemSet(@NotNull ProblemSet set);

    boolean changeProblemSetName(@Min(0) long setId, @NotBlank String setName, @Min(0) long operatorId);


    // endregion

    // region set problem
    Collection<SetProblem> getSetProblemsBySet(@Min(0) long setId);

    Collection<Long> getProblemIdsByChallengeHistory();

    boolean removeSetProblem(@Min(0) long setId, @Min(0) long problemId);

    int getMaxProblemIndex(@Min(0) long setId);
    // endregion
}
